<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>在线咨询</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		 <link href="css/iconfont.css" rel="stylesheet"/>
		 <link rel="stylesheet" href="css/default.css"/>
		<link rel="stylesheet" href="css/MUIxinyingCss.css"/>
	</head>
	<body class="mui-fullscreen">
		<!--页面主结构开始-->
		<div id="regApp" class="mui-views">
			<div class="mui-view">
				<div class="mui-navbar">
				</div>
				<div class="mui-pages">
				</div>
			</div>
		</div>
		<!--页面主结构结束-->
		<!--单页面开始-->
		<div id="reg_main" class="mui-page">
			<!--页面标题栏开始-->
			<div class="mui-navbar-inner mui-bar mui-bar-nav header_bar">
				<a href="##" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">
					<span class="mui-icon mui-icon-left-nav"></span>
				</a>
				<h1 class="mui-title">注册</h1>
			</div>
			<!--页面标题栏结束-->
			<!--页面主内容区开始-->
			<div class="mui-page-content">
				<div class="mui-scroll-wrapper reg_scroll_wrap">
					<div class="mui-scroll reg_scr">
						<div class="mui-content login_content">
							<form class="mui-input-group">
								<div class="mui-input-row">
									<label class="iconfont icon-phone"></label>
									<input id='account' type="text" class="mui-input-clear mui-input" placeholder="请输入手机号">
								</div>
								<div class="mui-input-row send_pasmit">
									<input id='password' type="password" class="mui-input-clear mui-input" placeholder="请输入短信效验码">
									<a href="##" class="send_short">获取短信效验码</a>
								</div>
								<div class="mui-input-row">
									<label class="iconfont icon-secret"></label>
									<input id='password' type="password" class="mui-input-clear mui-input" placeholder="请设置密码">
								</div>
							</form>
							<div class="readed readed_regist"><span class="read active"><span class="readed_btn">我已阅读并同意普露蕊医疗</span><a href="#regist_service">服务条款</a></span></div>
							<div class="mui-content-padded login_submit_btn">
								<button id='reg' class="mui-btn mui-btn-block mui-btn-primary">注册</button>
							</div>
							<div class="mui-content-padded to_login_box">
								<p>已有账号直接<span id="login" class="to_login">登录</span></p>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!--页面主内容区结束-->
		</div>
		<!--单页面结束-->
		<!--用户协议-->
		<div id="regist_service" class="mui-page">
			<div class="mui-navbar-inner mui-bar mui-bar-nav header_bar">
				<button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">
					<span class="mui-icon mui-icon-left-nav"></span>
				</button>--
				<h1 class="mui-center mui-title">用户协议</h1>
			</div>
			<div class="mui-page-content">
				<div class="mui-scroll-wrapper regist_service_wrap">
					<div class="mui-scroll regist_service_sroll">
						<div class="mui-content">
							<div class="mui-content-padded">
								<h2 class="mui-text-center user_acce">普露用户协议</h2>
								<p>注册真实可用，注册成功后的用户可用于登录，但是示例程序并未和服务端交互，用户相关数据仅存储于本地。</p>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--完善资料-->
		<div id="form_detail" class="mui-page">
			<div class="mui-navbar-inner mui-bar mui-bar-nav header_bar">
				<button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">
					<span class="mui-icon mui-icon-left-nav"></span><!--协议-->
				</button>
				<h1 class="mui-center mui-title">完善资料</h1>
			</div>
			<div class="mui-page-content">
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll">
						<ul class="mui-table-view">
							 <li class="mui-table-view-cell"><span>患者姓名：</span><input type="text" required="true" class="mui-input-clear" placeholder="张散"></li>
					         <li class="mui-table-view-cell"><span>职业：</span><input type="text" required="true" class="mui-input-clear" placeholder="销售员"></li>
					         <li class="mui-table-view-cell"><span>首次生育年龄：</span><input type="text" required="true" class="mui-input-clear" placeholder="24岁"></li>
					         <li class="mui-table-view-cell forward_right"><span>婚姻：</span><a href="#marriage" id="marriage_a" class="mui-navigate-right">未婚</a></li>
					         <li class="mui-table-view-cell"><span>月经史：</span><input type="text" required="true" class="mui-input-clear" placeholder="月经史"></li>
					         <li class="mui-table-view-cell"><span>既往病史：</span><input type="text" required="true" class="mui-input-clear" placeholder="既往病史"></li>
					         <li class="mui-table-view-cell"><span>家族史：</span><input type="text" required="true" class="mui-input-clear" placeholder="家族史"></li>
					         <li class="mui-table-view-cell"><span>个人史：</span><input type="text" required="true" class="mui-input-clear" placeholder="个人史"></li>
					         <li class="mui-table-view-cell forward_right"><span>主要症状：</span><a href="#symptom" id="symptom_a" class="mui-navigate-right">不孕不育</a></li>
						</ul>
						<div class="row mui-input-row illness">
							<h2>主要病情描述：</h2>
							<textarea id="question" class="mui-input-clear question" placeholder="请详细描述你的病情..."></textarea>
						</div>
						<div class="login_btn">
						        <a href="#free_dialogue">提交</a>
					   </div>
						
					</div>
				</div>
			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/jquery-1.11.2.min.js"></script>
		<script src="js/mui.view.js "></script>
		<script src="js/app.js"></script>
	</body>
	<script>
		mui.init();
		//初始化单页view
			var viewApi = mui('#regApp').view({
				defaultPage: '#reg_main'
			});
		//初始化单页的区域滚动
		mui('.mui-scroll-wrapper').scroll();
		var view = viewApi.view;
		(function($,doc) {
			//处理view的后退与webview后退
			var oldBack = $.back;
			$.back = function() {
				if (viewApi.canBack()) { //如果view可以后退，则执行view的后退
					viewApi.back();
				} else { //执行webview后退
					oldBack();
				};
			};
			
			$.plusReady(function() {
					var settings = app.getSettings();
					var regButton = doc.getElementById('reg');
					var to_login = doc.getElementById("login");
					var accountBox = doc.getElementById('account');
					var passwordBox = doc.getElementById('password');
					//var passwordConfirmBox = doc.getElementById('password_confirm');
					var emailBox = doc.getElementById('email');
					regButton.addEventListener('tap', function(event) {
						var regInfo = {
							account: accountBox.value,
							password: passwordBox.value,
							email: emailBox.value
						};
//						var passwordConfirm = passwordConfirmBox.value;
//						if (passwordConfirm != regInfo.password) {
//							plus.nativeUI.toast('密码两次输入不一致');
//							return;
//						}
						app.reg(regInfo, function(err) {
							if (err) {
								plus.nativeUI.toast(err);
								return;
							}
							plus.nativeUI.toast('注册成功');
							$.openWindow({
								url: 'login.html',
								id: 'login',
								show: {
									aniShow: 'pop-in'
								}
							});
						});
					});
					to_login.addEventListener("tap",function(event){
						$.openWindow({
								url: 'login.html',
								id: 'login',
								show: {
									aniShow: 'pop-in'
								}
							});
					});
				});
			
		})(mui,document);
		//验证码发送时间
			time.wait=10;  
			function time(defaule,waitTime) {
			        if (time.wait == 0) {
						defaule.off("tap").on("tap",function(){
												time(defaule,waitTime);
												});  
			           // defaule.attr("disabled",false);
			            defaule.text("获取短信效验码");
			            time.wait = waitTime;  
			        } else {
						defaule.off("tap");
			            //defaule.attr("disabled",true);
			            defaule.text("重新发送(" + time.wait-- + ")");
			            setTimeout(function() {
			                time(defaule,waitTime);
			            },
			            1000); 
			        }  
			    };
			$(".send_short").on("tap",function(){
				time($(".send_short"),time.wait);
			});
			$(".readed_btn").on("tap",function(){
				$(this).parent().toggleClass("active");
				});
	</script>

</html>